package com.kantboot.business.gc.controller;

import com.kantboot.business.gc.domain.dto.BusGcSwiperSavaDTO;
import com.kantboot.business.gc.domain.dto.BusGcSwiperSearchDTO;
import com.kantboot.business.gc.domain.entity.BusGcSwiper;
import com.kantboot.business.gc.service.IBusGcSwiperService;
import com.kantboot.util.common.result.RestResult;
import com.kantboot.util.core.param.PageParam;
import com.kantboot.util.core.result.PageResult;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/business/gc/swiper")
public class BusGcSwiperController {
    @Resource
    private IBusGcSwiperService service;


    @RequestMapping("/get")
    public RestResult<PageResult> getSwiper(@RequestBody PageParam<BusGcSwiperSearchDTO> param) {
        return RestResult.success(service.getSwiper(param),"getSuccess","获取成功");
    }

    @RequestMapping("/getAll")
    public RestResult getSwiper() {
        return RestResult.success(service.getAllSwiper(),"getSuccess","获取成功");
    }

    /**
     * add 新增轮播图
     */
    @RequestMapping("/save")
    public RestResult addSwiper(@RequestBody BusGcSwiperSavaDTO swiperSavaDTO) {
        return RestResult.success( service.addSwiper(swiperSavaDTO),"新增成功");
    }

    /**
     * delete 删除轮播图
     */
    @RequestMapping("/delete")
    public RestResult deleteSwiper(@RequestBody List<BusGcSwiper> tList) {
        service.deleteSwiper(tList);
        return RestResult.success(null,"删除成功");
    }
}
